import "./assets/index.css";
import "./assets/index.less";
import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

const yellow = require("./assets/pic.jpg");
console.log("my webpack test");
// for (var i = 0;i<3;i++) {
//     setTimeout(function() {
//         console.log('a'+i)
//     },0)
//     console.log('b'+i)
// }

function component() {
  const el = document.getElementById("app");
  const myImg = document.createElement("img");
  myImg.src = yellow.default;
  el.appendChild(myImg);
}
component();

let count = 1;
const el = document.getElementById("test");
function setData() {
  console.log(11111);
  el.innerHTML = count++;
}
function debounce(func, delay) {
  let timeout;
  // console.log('arg',arg)
  return function () {
    // console.log('before',timeout)
    if (timeout) {
        clearTimeout(timeout);
    }
    timeout = setTimeout(() => {
      func(arguments);
      timeout = null;
    }, delay);
  };
}
el.onmousemove = debounce(setData, 1000);
